package com.tyylab.kestrel.framework.spring.web.config;

import com.tyylab.kestrel.framework.spring.web.impl.WebHeaderInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web header configuration
 * Registers WebHeaderInterceptor for header extraction
 * 
 * @author tyylab
 */
@Configuration
public class WebHeaderConfig implements WebMvcConfigurer {
    
    @Bean
    public WebHeaderInterceptor webHeaderInterceptor() {
        return new WebHeaderInterceptor();
    }
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(webHeaderInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/error");
    }
} 